<script type="text/javascript" language="javascript" charset="utf-8">
$(".menu-wrap li").removeClass("active-link");
$(".menu-wrap #student").addClass("active-link");
</script>
<div class="mask">
</div>
<div class="common-tit">
  <h2>评价信息</h2>
  <span>学员管理 &gt; <%= link_to "学员列表", admin_students_path %> &gt; 评价信息</span>
  <div class="cours-gbtn">
    <a id="adEva" data-remote="true"  href="<%= new_admin_student_student_remark_path(@student) %>">添加评价</a>
  </div>
</div>
<div class="course-box">
  <h3>
    <span>评价信息</span>
  </h3>
  <div class="eva-sel clearfix">
    <div class="date-box1">
      <input type="text" class="date-list1" readOnly="true" placeholder="起始时间">
    </div>
    <div class="date-box2">
        <input type="text" class="date-list2" readOnly="true" placeholder="结束时间">
    </div>
  </div>
  <div class="eva-con">
    <div class="eva-ofbox">
      <% @student_remarks.each do |sr| %>
      <div class="eva-list">
        <div>
          <span>时间:</span>
          <em><%= sr.remark_at %></em>
          <span>姓名:</span>
          <em><%= sr.remark_people_name %></em>
        </div>
        <div>
          <p><%= sr.remark.html_safe %></p>
        </div>
      </div>
      <%end%>
    </div>
    <div class="apple_pagination">
      <%= paginate @student_remarks, :container => false %>
    </div>
  </div>
</div>
<script src="/assets/js/common.js"></script>
<script>
  $(function(){
     $('.date-list1').date_input();
     $(".date-list2").date_input();
   });
   $('.date-list2').on("click", function() {
     updateT1();
     $('.nav span').on("click", function() {
       if ($(this).parent().parent().parent().prev().attr("class") == "date-list2") {
         updateT1();
       };
     });
   });
   $('.date-list1').on("click", function() {
     updateT2();
     $('.nav span').on("click", function() {
       if ($(this).parent().parent().parent().prev().attr("class") == "date-list1") {
         updateT2();
       };
     });
   });

$(".date-list1").change(function() {
  transData();
});
$(".date-list2").change(function() {
  transData();
});
 function transData() {
  var transD = "";
  if ($(".date-list1").val() == "") {
    transD += "begin_time" + "=" + "all";
  } else {
    transD += "begin_time" + "=" + $(".date-list1").val();
  }
  if ($(".date-list2").val() == "") {
    transD += "&" + "end_time" + "=" + "all";
  } else {
    transD += "&" + "end_time" + "=" + $(".date-list2").val();
  }
  // console.log(transD);
  $.ajax({
    type:'get', url:"/admin/students/" + <%= @student.id %> + "/student_remarks/get_data_list?"+ transD,
    success: function(data) {
      if (data.error) {
        // console.log("wrong");
      } 
    }
  });
};
</script>
